<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>业务表管理</title>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use('table', function(){
				let table = layui.table;
				table.init('layui-filter-table1',{
					escape : false
					,height: getLayuiTableHeight()
					,className: 'layui-table-custom'
					,done: function (res,curr,count){
					}
				});
			});
		});
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs nav-tabs-bottom mb-0">
		<li class="nav-item"><a class="nav-link active" href="${ctxAdmin}/gen/genTable/">业务表列表</a></li>
		<shiro:hasPermission name="gen:genTable:edit">
		<li class="nav-item"><a class="nav-link" href="${ctxAdmin}/gen/genTable/form">业务表添加</a></li>
		</shiro:hasPermission>
	</ul>
	<div class="content">
		<sys:message content="${message}"/>
		<div class="card">
			<form:form id="searchForm" class="form-inline"
				   modelAttribute="genTable" method="post"
				   action="${ctxAdmin}/gen/genTable">
				<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
				<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<%--				<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>--%>
				<div class="input-group input-group-sm">
					<div class="input-group-prepend">
						<span class="input-group-text">表名</span>
					</div>
					<form:input path="nameLike" htmlEscape="false" maxlength="100" class="form-control"/>
				</div>
				<div class="input-group input-group-sm">
					<div class="input-group-prepend">
						<span class="input-group-text">说明</span>
					</div>
					<form:input path="comments" htmlEscape="false" maxlength="100" class="form-control"/>
				</div>
				<div class="input-group input-group-sm">
					<div class="input-group-prepend">
						<span class="input-group-text">父表表名</span>
					</div>
					<form:input path="parentTable" htmlEscape="false" maxlength="100" class="form-control"/>
				</div>
				<div class="btn-group btn-group-sm">
					<button id="btnSubmit" type="submit" class="btn btn-primary " onclick="return page();">查询</button>
					<button id="btnReset" type="button" class="btn btn-success" onclick="resetForm();page();">重置</button>
				</div>
			</form:form>
			<table id="layui-table-id1" lay-filter="layui-filter-table1" style="display: none;">
				<thead>
					<tr>
						<th lay-data="{field:'checkbox',type: 'checkbox', fixed: 'left'}"></th>
						<th lay-data="{field:'id',hide:true}">ID</th>
						<th lay-data="{field:'a.name',width:200}">表名</th>
						<th lay-data="{field:'a.description',width:200}">说明</th>
						<th lay-data="{field:'a.class_name',width:200}">类名</th>
						<th lay-data="{field:'a.parent_table',width:200}">父表</th>
						<shiro:hasPermission name="gen:genTable:edit">
							<th lay-data="{field:'opt',align:'center',width: 120}">操作</th>
						</shiro:hasPermission>
					</tr>
				</thead>
				<tbody>
				<c:forEach items="${page.list}" var="genTable">
					<tr>
						<td></td>
						<td></td>
						<td><a href="${ctxAdmin}/gen/genTable/form?id=${genTable.id}">${genTable.name}</a></td>
						<td>${genTable.comments}</td>
						<td>${genTable.className}</td>
						<td title="点击查询子表"><a href="javascript:" onclick="$('#parentTable').val('${genTable.parentTable}');$('#searchForm').submit();">${genTable.parentTable}</a></td>
						<shiro:hasPermission name="gen:genTable:edit"><td>
							<a href="${ctxAdmin}/gen/genTable/form?id=${genTable.id}">修改</a>
							<a href="${ctxAdmin}/gen/genTable/delete?id=${genTable.id}" onclick="return confirmx('确认要删除该业务表吗？', this.href)">删除</a>
						</td></shiro:hasPermission>
					</tr>
				</c:forEach>
				</tbody>
			</table>
			<sys:laypage page="${page}"/>
		</div>
	</div>
</body>
</html>
